<template>
  <div class="page-div">
    <MessageWinComponent ref="message-ref"/>
    <span style="color: red">* 如果下拉框内无数据，可直接单击【刷新】按钮，后台执行全量缓存刷新</span>
    <SelectComboComponent ref="cacheType-ref" group-code="G0002" input-lable="刷新类型" input-name="cacheType"/>
    <Button text="刷新" :click-function="refreshCache"/>
  </div>
</template>

<script>
import SelectComboComponent from "@/components/input/SelectComboComponent";
import Button from "@/components/button/ButtonComponent";
import {postRequest} from "@/axio2";
import MessageWinComponent from "@/components/win/MessageWinComponent";

export default {
  name: "CacheManage",
  components: {MessageWinComponent, Button, SelectComboComponent},
  methods:{
    refreshCache(){
      let params = this.$refs["cacheType-ref"].getInputValue();
      let requestParam = {'cacheType': params["value"]+''};
      postRequest(
          "cache/refresh.do",
          requestParam,
          this.refreshSuccess,
          this.refreshFail,
          this
      );
    },
    refreshSuccess(resp,component){
      this.$refs["message-ref"].setMessage("刷新成功");
      this.$refs["message-ref"].showWin();
    },
    refreshFail(resp,component){
      this.$refs["message-ref"].setMessage("刷新失败，请查看后台");
      this.$refs["message-ref"].showWin();
    }
  }
}
</script>

<style scoped>

</style>